import 'package:sports_new/utils/routes.dart';

enum AiType {
  lm(id: 1, name: "冷门监测", tag: "bl", route: Routes.aiLm, label: "ai_lm"),
  radar(
      id: 2, name: "雷达寻踪", tag: "ld", route: Routes.aiRadar, label: "ai_radar"),
  trend(
      id: 3, name: "趋势异动", tag: "qs", route: Routes.aiTrend, label: "ai_trend"),
  faith(
      id: 4, name: "信心助力", tag: "xx", route: Routes.aiFaith, label: "ai_faith"),
  assess(
      id: 5,
      name: "胜平负锦囊",
      tag: "yj",
      route: Routes.aiAssess,
      label: "ai_assess"),
  pre(id: 6, name: "战前盘势", tag: "ps", route: Routes.aiPre, label: "ai_pre"),
  bounce(
      id: 7,
      name: "极限反弹",
      tag: "jx",
      route: Routes.aiBounce,
      label: "ai_bounce"),
  combo(
      id: 8,
      name: "精选2串1",
      tag: "combo",
      route: Routes.aiCombo,
      label: "ai_combo"),
  plan(
      id: 9,
      name: "专家方案分布",
      tag: "planCnt",
      route: Routes.aiPlan,
      label: "ai_planCnt");

  final String name;
  final String tag;
  final String route;
  final String label;
  final int id;

  const AiType(
      {required this.name,
      required this.tag,
      required this.route,
      required this.label,
      required this.id});

  static AiType? getTypeByRoute(String route) {
    for (var e in AiType.values) {
      if (route.contains(e.route)) {
        return e;
      }
    }
    return null;
  }

  static AiType? getTypeByName(String name) {
    for (var e in AiType.values) {
      if (name.contains(e.name)) {
        return e;
      }
    }
    return null;
  }

  static AiType? getTypeByTag(String tag) {
    for (var e in AiType.values) {
      if (tag.contains(e.tag)) {
        return e;
      }
    }
    return null;
  }

  static AiType? getTypeByLabel(String label) {
    for (var e in AiType.values) {
      if (label.contains(e.label)) {
        return e;
      }
    }
    return null;
  }

  static AiType? getTypeByPayId(int payId) {
    for (var e in AiType.values) {
      if (payId == e.id) {
        return e;
      }
    }
    return null;
  }
}
